<template>
	<view class="box">
		<navtop :back='true' title="绑定邀请码"></navtop>
		<view class="list">
			<view class="li">
				<view class="name">填写邀请码</view>
				<view class="edit">
					<input type="number" v-model="code" placeholder="请输入邀请码"/>
				</view>
			</view>
			<view class="tps" v-if="agent_cion">
				填写邀请码可获得{{agent_cion}}奖励；
			</view>
		</view>
		<view class="quitbtn" @click="get_btn()">提交保存</view>
	</view>
</template>

<script>
    let that = null;
    export default {
        data() {
            return {
				code: '',
				agent_cion: '',
            }
        },
        mounted() {
            that = this;
			that.get_data()
        },
        methods: {
			get_data(){
				that.http.get_curl('user/agent',{},function(res){
					if(res.code == 1){
						that.agent_cion = res.data.agent_cion;
					}
				});
			},
			get_btn() {
				that.http.get_curl('user/lnvitecode',{code:that.code},function(res){
					if(res.code == 1){
						uni.showToast({
							title: '保存成功'
						});
						setTimeout(()=>{
							uni.navigateBack();
						},500)
					}
				});
			}
        }
    }
</script>

<style lang="scss">
	image{width: 100%;height: 100%;}
	.list{padding: 0 32rpx;background: #fff;padding-top: 20rpx;
		.li{width: 100%;
			.name{font-size: 30rpx;color: #333;width: 100%;}
			.edit{font-size: 28rpx;color: #999;width: 100%;margin-top: 10rpx;
				.icon{margin-left: 10rpx;}
				input{height: 80rpx;font-size: 28rpx;width: 100%;}
			}
		}
		.tps{padding: 20rpx 0;font-size:24rpx;color:#f15d25;}
	}
	.quitbtn{width: 70%;line-height: 80rpx;text-align: center;background: linear-gradient(270deg, #fcae3a, #f15d25);border-radius: 10rpx;font-size: 30rpx;margin: 0 auto;margin-top: 20rpx;color: #fff;}
</style>